 |
 |
 |
 |
#229857 - 12/26/02 04:38 AM
[6.2] Profile Birthdays 1.5
|
I type Like navaho
Registered: 11/29/01
Posts: 11330
Loc: Charlotte, NC
|
Mod Name / Version - Profile Birthdays 1.5 <br /> ver 1.1 fixes a bug where the "Happy Birthday" message repeated with each category. <br /> Lists the usernames in alphabetical order for a neater look. <br /> ver 1.2 update to work with UBB.Threads 6.2, adds the year and age calculation as an option <br /> ver 1.3 updates the age calculation function and fixes a bug. <br /> ver 1.4 fixes a bug where the date of the birthday wasn't displaying <br /> ver 1.5 fixes the age calculation bug. Thanks to Dimopoulos and JustDave for help in nailing that down. <img src="/forum/images/graemlins/wink.gif" alt="" /> <br /> <br /> Description - This modification will allow users to enter their birthdays into their profile and display birthday info. <br /> <br /> Working Under - UBB.Threads 6.2 <br /> <br /> Features - <br /> - Birthday will Display in their Profile.
- Age will appear in their Profile if they have entered the year of their Birth. (Thanks Dimopoulos)
- Bottom of Main Index Will Display "Today's Birthdays" and "This
- Months Birthdays" if there are any.
- Birthday Names will link to the users profiles.
- Top of Main Index will wish the User a Happy Birthday if It's their
- Birthday.
- Bottom of Main Index will offer a link to update their profile if the profile does not contain the Birthday Info
- If they have completed their whole birthday, an accurate age will be calculated.
- If they have only filled in their birthyear, an aprox. age will be calculated. <br />
<br /> <br /> Pre-requisites - none <br /> <br /> Author - JoshPet - www.joshuapettit.com <br /> <br /> Credits - PamW of www.thesoulelement.com for requesting it. Thanks to Dimopoulos for adding the year to the code. Thanks to Dave_L for help with the age calculation. <br /> <br /> Files Altered - editbasic.tmpl, editbasic.php, changebasic.php, ubbthreads.php, ubbthreads.tmpl, showprofile.php, showprofile.tmpl <br /> <br /> Database Altered - Three Fields added to the w3t_Users table (U_BirthMonth, U_BirthDay, U_BirthYear). <br /> <br /> New Files - none <br /> <br /> Other Info - Backup your database and your files before modifing!!!!! <br /> <br /> Add On Available - A birthday Cron addon is available here. It automatically can send PMs or Make Posts for people's birthdays. <img src="/forum/images/graemlins/smile.gif" alt="" /> <br />
Attachments
62525-ProfileBirthday1.5.txt (290 downloads)
Edited by JoshPet (03/22/03 12:32 PM)
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#229901 - 01/08/03 03:50 AM
Re: [6.2] Profile Birthdays 1.3
[Re: Daine]
|
Addict
Registered: 04/23/02
Posts: 1929
Loc: Virginia, USA
|
[]... Dave's grab birthday fields ... grab the month, day and year, as separate fields ...[/] <br /> <br />In the changes to adduser.php in Grab Birthdate 1.0.0: <br /> <br /> // Store birthdate (part 3 of 2). <br /> ... <br /> @list($dob, $dob_crc) = explode('-', $dob_with_crc); <br /> if (!$dob or ...) { <br /> $html -> not_right('dob invalid', $Cat); <br /> } <br /> [:"red"]$year = substr($dob, 0, 4); <br /> $month = substr($dob, 4, 2); <br /> $day = substr($dob, 6, 2); <br /> if (!checkdate($month, $day, $year)) { <br /> $html -> not_right('dob invalid (2)', $Cat); <br /> }[/] <br /> <br />// ---------------------------------- <br />// Insert this user into the database <br /> $query = " <br /> INSERT INTO {$config['tbprefix']}Users (...) <br /> VALUES (...) <br /> "; <br /> $dbh -> do_query($query); <br /> <br />The above is untested, but should work. <br /> <br />The added call to checkdate() is not essential, since the date has already been checked, but might be worthwhile in the event that some of the other code for this hack were to get changed. <br /> <br />The INSERT INTO would also have to be modified to insert $year, $month and $day instead of, or in addition to, $dob. <br /> <br />I was going to stick a delimiter into the DOB query string parameter so that explode() could be used, rather than substr(), but I'm already using "-", and I couldn't think of a different one.
_________________________
UBB.threads beta tester / threadsdev.com moderator Software consulting services including UBB.threads problem resolution / installs / upgrades / customization.
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#229928 - 01/27/03 05:33 PM
Re: [6.2] Profile Birthdays 1.4
[Re: casper_dup1]
|
Kahuna
Registered: 08/18/02
Posts: 1271
Loc: Vienna, Austria
|
Alison,<br /><br />You have two areas where you can have a look at:<br /><br />1. The actual loading of the data in the editbasic.php script - which then is displayed on screen. Try to access your database and using a tool like phpMyAdmin find your record in the w3t_Users table and edit it. Change the BirthYear for instance and put something like 2003. Open your My Home/Personal Information and have a look whether the 2003 is up there. If yes then your editbasic.php does its job properly. You might want to repeat the test by putting Jan for the BirthMonth and 27 for the day just in case.<br /><br />2. The changebasic.php file and the query it runs. Two areas to check in this script: First at the top to see whether the variables are passed correctly in the script and last if the SQL statement is constructed properly.<br /><br />What I usually do is put some small print statements which I remove after to see whether a variable has the correct value.<br /><br />In the changebasic.php at the end you have <br /> <br />// ---------------------------------------------------<br />// Send them to their start page with the confirmation<br /> $html -> start_page($Cat);<br /> <br />Temporarily change it to <br /> <br />print "$query";<br />// ---------------------------------------------------<br />// Send them to their start page with the confirmation<br />// $html -> start_page($Cat);<br /> <br /><br />and go and change your birthdate. You should see that the query will be printed on screen and it will be something like<br /> <br />UPDATE w3t_Users SET ........ U_BirthDay='27', U_BirthMonth='Jan', U_BirthYear='2003' WHERE ....<br /> <br /><br />If this is not the case then you have something wrong and you should check the instructions again.<br /><br /> NOTE: Remember to change the <br /> <br />print "$query";<br />// ---------------------------------------------------<br />// Send them to their start page with the confirmation<br />// $html -> start_page($Cat);<br /> <br />to<br /> <br />// ---------------------------------------------------<br />// Send them to their start page with the confirmation<br /> $html -> start_page($Cat);<br /> <br />after you finish<br /><br />I hoipe this helps<br /><br />Warm regards<br /><br />Nikos
_________________________
Nikos
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#229952 - 02/19/03 06:04 PM
Re: [6.2] Profile Birthdays 1.4
[Re: Daine]
|
Kahuna
Registered: 08/18/02
Posts: 1271
Loc: Vienna, Austria
|
I don't know if anyone has seen this or it has been mentioned on this thread (heck I am really tired now) but for some users I kept on getting a mktime error at the top of the showprofile screen. The reason was the epoch time and the users inputting their year of birth to numbers less than 1970. A simple workaround will sort this.<br /><br />Open showprofile.php<br />Find:<br /> <br /> if (($Birthmonth) && ($BirthDay) && ($BirthYear)) <br /> {<br /> $epochbday = mktime (0,0,0,$Birthmonth,$BirthDay,$BirthYear);<br /> $currentday = time();<br /> $epochage = $currentday - $epochbday;<br /> $age = intval($epochage / 31536000);<br /><br />and change it to this:<br /> <br /> if (($Birthmonth) && ($BirthDay) && ($BirthYear)) <br /> {<br /> if ( $BirthYear < 1970 )<br /> {<br /> $DatePlus = 1970 - $BirthYear;<br /> $BirthYear = 1970;<br /> }<br /> else <br /> {<br /> $DatePlus = 0;<br /> }<br /> <br /> $epochbday = mktime (0,0,0,$Birthmonth,$BirthDay,$BirthYear);<br /> $currentday = time();<br /> $epochage = $currentday - $epochbday;<br /> $age = intval($epochage / 31536000) + $DatePlus;<br />
_________________________
Nikos
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|